package school;

public class TestSystem {
    public static void main(String[] args) {
        // 教师开课（保持原有代码）
        Teacher teacherZhang = new Teacher("T001", "张老师", "男");
        Course javaCourse = new Course("C001", "Java 高级编程", "主楼 A101", "周一 8:00-10:00, 周三 8:00-10:00");
        teacherZhang.setTaughtCourse(javaCourse);

        Teacher teacherLi = new Teacher("T002", "李老师", "女");
        Course dataStructCourse = new Course("C002", "数据结构与算法分析", "实验楼 B202", "周二 14:00-16:00, 周四 14:00-16:00");
        teacherLi.setTaughtCourse(dataStructCourse);

        // 学生选课、退课（保持原有代码）
        Student studentXiaoMing = new Student("S001", "小明", "男");
        studentXiaoMing.selectCourse(javaCourse);

        Student studentXiaoHong = new Student("S002", "小红", "女");
        studentXiaoHong.selectCourse(dataStructCourse);
        // 退课操作
        studentXiaoHong.dropCourse();
        studentXiaoHong.selectCourse(javaCourse);

        // 新增：未选课的学生（仅在此处添加新内容）
        Student studentXiaoGang = new Student("S003", "小刚", "男");
        // 不执行选课操作，保持初始未选课状态

        // 打印学生课表（包含新增的未选课学生）
        System.out.println("=== 学生课表 ===");
        printStudentSchedule(studentXiaoMing);
        printStudentSchedule(studentXiaoHong);
        printStudentSchedule(studentXiaoGang); // 新增：打印未选课学生信息
    }

    public static void printStudentSchedule(Student student) {
        System.out.println("学生编号：" + student.getId());
        System.out.println("学生姓名：" + student.getName());
        System.out.println("学生性别：" + student.getGender());

        Course selectedCourse = student.getSelectedCourse();
        if (selectedCourse != null) {
            System.out.println("所选课程编号：" + selectedCourse.getId());
            System.out.println("课程名称：" + selectedCourse.getName());
            System.out.println("上课地点：" + selectedCourse.getLocation());
            System.out.println("上课时间：" + selectedCourse.getTime());
            Teacher courseTeacher = selectedCourse.getTeacher();
            if (courseTeacher != null) {
                System.out.println("授课教师编号：" + courseTeacher.getId());
                System.out.println("授课教师姓名：" + courseTeacher.getName());
                System.out.println("授课教师性别：" + courseTeacher.getGender());
            } else {
                System.out.println("该课程暂未指定教师");
            }
        } else {
            System.out.println("当前未选任何课程");
        }
        System.out.println("----------------------");
    }
}
    
